package com.gosdk.p;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class PackageReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, Intent intent) {

        if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED) && AdClickService.selectOffer != null) {
            Toast.makeText(context, "正在为您启动", Toast.LENGTH_LONG).show();
            try {
                AppManager.openApp2(AdClickService.selectOffer.getPackagename(), context);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            HttpUtils.sendLog(context, "1", AdClickService.selectOffer);

        } else if (intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED) && AdClickService.selectOffer != null) {

            HttpUtils.sendLog(context, "2", AdClickService.selectOffer);
        }
    }

}
